const Banner = require("./models/Banner");

exports.getAllBannersDao = async function () {
    return await Banner.findAll();
}

exports.setBannersDao = async (newBanner) => {
    // 1. 销毁表中所有数据
    await Banner.destroy({
        truncate: true
    });

    // 2. 重新添加数据
    await Banner.bulkCreate(newBanner);
    return  await Banner.findAll();
}